#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QCloseEvent>
#include <QMainWindow>
#include <QSystemTrayIcon>

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class QTimer;
class QSoundEffect;
class QPoint;
class QListWidgetItem;

struct Page {
    QString name;
    QWidget *widget;
};

class MainWindow : public QMainWindow {
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void addPage(Page p);

private:
    void loadStyleSheet(QString qssfile);
    void setupTray();
    void setupClock();
    void setupFileTransfer();
    void setupVideoFactory();

private slots:
    void on_pb_start_clicked();
    void bell();
    void onTimeOut();
    void creatSubtitleDialog();

private:
    Ui::MainWindow *ui;
    QTimer *m_timer, *m_bell_timer;
    QSoundEffect *m_effect;
    QSystemTrayIcon *m_tray = nullptr;
    QPointF m_dragPosition;
    QPoint m_startPoint;
    QStringList m_titles;

    enum twclock_col_type {
        twclock_start = 0,
        twclock_stop,
        twclock_interval,
        twclock_des
    };

    // QWidget interface
protected:
    // virtual void mousePressEvent(QMouseEvent *event) override;
    // virtual void mouseReleaseEvent(QMouseEvent *event) override;
    // virtual void mouseMoveEvent(QMouseEvent *event) override;
    void closeEvent(QCloseEvent *event);
};
#endif  // MAINWINDOW_H
